/* 
 * Modbus app for RTU.
 * Copyright (c) 2012  apleilx
 * All rights reserved.
 * no limite
 */

/* ----------------------- Platform includes --------------------------------*/
#define _MBAPP_MODULE_
#include "mbapp.h"
#include "systimer.h"

uint8_t mbInited = 0;


/*****************************************************************************//*!
* @brief   	Slave device handle.
*               
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/   
void ModbusTaskEntry (void *argument)
{

    if(!mbInited)
    {
        mbxInit(MB_RTU_SLAVE, 9600, MB_PAR_NONE);
        mbxObj.SlaveId=2;
        mbInited = 1;
    }
    
    if(0 == mbxObj.RunSt.bits.MasterMode)
    {
        mbSlavePoll(&mbxObj);
    }
    else
    {
        
    }
    
    if(sys_pulse.bPulse_1s)
    {
        RegHolding[0x40].uVal++;
    }
}


